﻿using Architecture.Domain.Service;
using Architeture.Domain;
using MediatR;
using RBAC.ZhuBoLin.Application.Command.RoleCommand.Slaughter;

namespace RBAC.ZhuBoLin.Application.CommandHandlers.RoleHandler.Slaughter
{
    public class SlaughterCreateCommandHandler : IRequestHandler<SlaughterCreateCommand, int>
    {
        protected readonly ISlaughterService service;

        public SlaughterCreateCommandHandler(ISlaughterService service)
        {
            this.service = service;
        }

        public async Task<int> Handle(SlaughterCreateCommand request, CancellationToken cancellationToken)
        {
            return await service.SlaughterAdd(new slaughterInfo() { GoodsInfoid = request.GoodsInfoid, batch = request.batch, weight = request.weight, bTime = request.bTime, ETime = request.ETime, slaughterInfoid = request.slaughterInfoid });
        }
    }
}
